using System;
using Microsoft.SPOT;
using System.Reflection;
using System.Globalization;
using System.Threading;

namespace MicroSnake
{
    static class Util
    {
        /// <summary>
        /// Reset the Resource Manager so that we can change culture at run-time (Hack)
        /// </summary>
        private static void ResetResourceManager()
        {
            FieldInfo fieldInfo = typeof(Resources).GetField("manager", BindingFlags.NonPublic | BindingFlags.Static);
            fieldInfo.SetValue(null, null);
        }

        public static void SetCulture(string cultureName)
        {
            // TODO: Save the culture setting in the flash memory
            ResourceUtility.SetCurrentUICulture(new CultureInfo(cultureName));
            Util.ResetResourceManager();
            ScreenManager.DestroyAllScreen();
        }

        public static void SetDifficultyLevel(DifficultyLevels difficultyLevel)
        {
            Rounds.DifficultyLevel = difficultyLevel;

        }

        public static void PrintThreadInfo(string msg)
        {
            Debug.Print(msg + Thread.CurrentThread.GetHashCode().ToString());
        }
    }
}
